package com.example.app

import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET

//class Retrofit {
//}

interface API {
    @GET("lessons")
    fun lesson(): Call<Any>
}

val RETROFIT: Retrofit = Retrofit.Builder().baseUrl("xxx").build()
/*
fun <T> create(clazz:Class<T>):T{
    return RETROFIT.create(clazz)
}
fun main(){
    println(create(API::class.java))
}
*/

//通过内联函数和reified优化以上代码：
inline fun <reified T> create(): T {
    return RETROFIT.create(T::class.java)
}

fun main() {
    println(create<API>())
}
